#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["service/src/Presentation/SiyinPractice.Web.Host/SiyinPractice.Web.Host.csproj", "service/src/Presentation/SiyinPractice.Web.Host/"]
COPY ["framework/src/Framework/SiyinPractice.Web.Core/SiyinPractice.Web.Core.csproj", "framework/src/Framework/SiyinPractice.Web.Core/"]
COPY ["framework/src/Domain/SiyinPractice.Domain.Core/SiyinPractice.Domain.Core.csproj", "framework/src/Domain/SiyinPractice.Domain.Core/"]
COPY ["framework/src/Infrastructure/SiyinPractice.Infrastructure.EntityFramework.SqlServer/SiyinPractice.Infrastructure.EntityFramework.SqlServer.csproj", "framework/src/Infrastructure/SiyinPractice.Infrastructure.EntityFramework.SqlServer/"]
COPY ["framework/src/Infrastructure/SiyinPractice.Infrastructure.EntityFramework/SiyinPractice.Infrastructure.EntityFramework.csproj", "framework/src/Infrastructure/SiyinPractice.Infrastructure.EntityFramework/"]
COPY ["framework/src/Framework/SiyinPractice.Framework/SiyinPractice.Framework.csproj", "framework/src/Framework/SiyinPractice.Framework/"]
COPY ["service/src/Modules/Maintenance/SiyinPractice.Interface.Maintenance/SiyinPractice.Interface.Maintenance.csproj", "service/src/Modules/Maintenance/SiyinPractice.Interface.Maintenance/"]
COPY ["framework/src/Framework/SiyinPractice.Caching/SiyinPractice.Caching.csproj", "framework/src/Framework/SiyinPractice.Caching/"]
COPY ["framework/src/Interface/SiyinPractice.Interface.Core/SiyinPractice.Interface.Core.csproj", "framework/src/Interface/SiyinPractice.Interface.Core/"]
COPY ["framework/src/Shared/SiyinPractice.Shared.Core/SiyinPractice.Shared.Core.csproj", "framework/src/Shared/SiyinPractice.Shared.Core/"]
COPY ["service/src/Modules/Maintenance/SiyinPractice.Domain.Maintenance.Shared/SiyinPractice.Domain.Shared.Maintenance.csproj", "service/src/Modules/Maintenance/SiyinPractice.Domain.Maintenance.Shared/"]
COPY ["framework/src/Domain/SiyinPractice.Domain.Shared/SiyinPractice.Domain.Shared.csproj", "framework/src/Domain/SiyinPractice.Domain.Shared/"]
COPY ["service/src/Modules/Maintenance/SiyinPractice.Shared.Maintenance/SiyinPractice.Shared.Maintenance.csproj", "service/src/Modules/Maintenance/SiyinPractice.Shared.Maintenance/"]
COPY ["framework/src/Framework/SiyinPractice.AutoMapper/SiyinPractice.Mapper.csproj", "framework/src/Framework/SiyinPractice.AutoMapper/"]
COPY ["service/src/Modules/Maintenance/SiyinPractice.Application.Maintenance/SiyinPractice.Application.Maintenance.csproj", "service/src/Modules/Maintenance/SiyinPractice.Application.Maintenance/"]
COPY ["framework/src/Application/SiyinPractice.Application.Core/SiyinPractice.Application.Core.csproj", "framework/src/Application/SiyinPractice.Application.Core/"]
COPY ["service/src/Modules/Maintenance/SiyinPractice.Domain.Maintenance/SiyinPractice.Domain.Maintenance.csproj", "service/src/Modules/Maintenance/SiyinPractice.Domain.Maintenance/"]
COPY ["framework/src/Domain/SiyinPractice.Domain.Business/SiyinPractice.Domain.Business.csproj", "framework/src/Domain/SiyinPractice.Domain.Business/"]
COPY ["framework/src/Framework/SiyinPractice.Logging.Serilog/SiyinPractice.Logging.Serilog.csproj", "framework/src/Framework/SiyinPractice.Logging.Serilog/"]
COPY ["service/src/Modules/AccessControl/SiyinPractice.Application.AccessControl/SiyinPractice.Application.AccessControl.csproj", "service/src/Modules/AccessControl/SiyinPractice.Application.AccessControl/"]
COPY ["service/src/Modules/AccessControl/SiyinPractice.Domain.AccessControl/SiyinPractice.Domain.AccessControl.csproj", "service/src/Modules/AccessControl/SiyinPractice.Domain.AccessControl/"]
COPY ["service/src/Modules/AccessControl/SiyinPractice.Interface.AccessControl/SiyinPractice.Interface.AccessControl.csproj", "service/src/Modules/AccessControl/SiyinPractice.Interface.AccessControl/"]
COPY ["service/src/Modules/AccessControl/SiyinPractice.Domain.Shared.AccessControl/SiyinPractice.Domain.Shared.AccessControl.csproj", "service/src/Modules/AccessControl/SiyinPractice.Domain.Shared.AccessControl/"]
COPY ["service/src/Modules/AccessControl/SiyinPractice.Shared.AccessControl/SiyinPractice.Shared.AccessControl.csproj", "service/src/Modules/AccessControl/SiyinPractice.Shared.AccessControl/"]
COPY ["service/src/Modules/AccessControl/SiyinPractice.Infrastructure.DataStore.AccessControl/SiyinPractice.Infrastructure.DataStore.AccessControl.csproj", "service/src/Modules/AccessControl/SiyinPractice.Infrastructure.DataStore.AccessControl/"]
COPY ["service/src/Modules/BasicData/SiyinPractice.Application.BasicData/SiyinPractice.Application.BasicData.csproj", "service/src/Modules/BasicData/SiyinPractice.Application.BasicData/"]
COPY ["service/src/Modules/BasicData/SiyinPractice.Domain.BasicData/SiyinPractice.Domain.BasicData.csproj", "service/src/Modules/BasicData/SiyinPractice.Domain.BasicData/"]
COPY ["service/src/Modules/BasicData/SiyinPractice.Interface.BasicData/SiyinPractice.Interface.BasicData.csproj", "service/src/Modules/BasicData/SiyinPractice.Interface.BasicData/"]
COPY ["service/src/Modules/BasicData/SiyinPractice.Shared.BasicData/SiyinPractice.Shared.BasicData.csproj", "service/src/Modules/BasicData/SiyinPractice.Shared.BasicData/"]
COPY ["service/src/Modules/BasicData/SiyinPractice.Infrastructure.DataStore.BasicData/SiyinPractice.Infrastructure.DataStore.BasicData.csproj", "service/src/Modules/BasicData/SiyinPractice.Infrastructure.DataStore.BasicData/"]
COPY ["service/src/Modules/FileByUploqdAndDown/SiyinPractice.Application.FileByUploadAndDown/SiyinPractice.Application.FileByUploadAndDown.csproj", "service/src/Modules/FileByUploqdAndDown/SiyinPractice.Application.FileByUploadAndDown/"]
COPY ["service/src/Modules/FileByUploqdAndDown/SiyinPractice.Domain.FileByUploadAndDown/SiyinPractice.Domain.FileByUploadAndDown.csproj", "service/src/Modules/FileByUploqdAndDown/SiyinPractice.Domain.FileByUploadAndDown/"]
COPY ["service/src/Modules/FileByUploqdAndDown/SiyinPractice.Interface.FileByUploadAndDown/SiyinPractice.Interface.FileByUploadAndDown.csproj", "service/src/Modules/FileByUploqdAndDown/SiyinPractice.Interface.FileByUploadAndDown/"]
COPY ["service/src/Modules/FileByUploqdAndDown/SiyinPractice.Shared.FileByUploadAndDown/SiyinPractice.Shared.FileByUploadAndDown.csproj", "service/src/Modules/FileByUploqdAndDown/SiyinPractice.Shared.FileByUploadAndDown/"]
COPY ["service/src/Modules/FileByUploqdAndDown/SiyinPractice.Infrastruture.DataStore.FileByUploadAndDown/SiyinPractice.Infrastructure.DataStore.FileByUploadAndDown.csproj", "service/src/Modules/FileByUploqdAndDown/SiyinPractice.Infrastruture.DataStore.FileByUploadAndDown/"]
COPY ["service/src/Modules/Maintenance/SiyinPractice.Infrastructure.DataStore.Maintenance/SiyinPractice.Infrastructure.DataStore.Maintenance.csproj", "service/src/Modules/Maintenance/SiyinPractice.Infrastructure.DataStore.Maintenance/"]
COPY ["service/src/Modules/ProjectManagement/SiyinPractice.Application.ProjectManagement/SiyinPractice.Application.ProjectManagement.csproj", "service/src/Modules/ProjectManagement/SiyinPractice.Application.ProjectManagement/"]
COPY ["service/src/Modules/ProjectManagement/SiyinPractice.Domain.ProjectManagement/SiyinPractice.Domain.ProjectManagement.csproj", "service/src/Modules/ProjectManagement/SiyinPractice.Domain.ProjectManagement/"]
COPY ["service/src/Modules/ProjectManagement/SiyinPractice.Interface.ProjectManagement/SiyinPractice.Interface.ProjectManagement.csproj", "service/src/Modules/ProjectManagement/SiyinPractice.Interface.ProjectManagement/"]
COPY ["service/src/Modules/ProjectManagement/SiyinPractice.Shared.ProjectManagement/SiyinPractice.Shared.ProjectManagement.csproj", "service/src/Modules/ProjectManagement/SiyinPractice.Shared.ProjectManagement/"]
COPY ["service/src/Modules/ProjectManagement/SiyinPractice.Infrastructure.DataStore.ProjectManagement/SiyinPractice.Infrastructure.DataStore.ProjectManagement.csproj", "service/src/Modules/ProjectManagement/SiyinPractice.Infrastructure.DataStore.ProjectManagement/"]
RUN dotnet restore "./service/src/Presentation/SiyinPractice.Web.Host/./SiyinPractice.Web.Host.csproj"
COPY . .
WORKDIR "/src/service/src/Presentation/SiyinPractice.Web.Host"
RUN dotnet build "./SiyinPractice.Web.Host.csproj" -c %BUILD_CONFIGURATION% -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./SiyinPractice.Web.Host.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SiyinPractice.Web.Host.dll"]